﻿@model MezmurStore2.Models.Album

@{
    ViewBag.Title = "Upload Tracks";
}
<h2>Upload Track</h2>
<br />
<h3>Select the audio tracks for this album:</h3>
<br />

<table>
    <tr>
        <td><img style="margin:50 50 50 50" src="@Url.Content(@Model.Poster)" alt="@Model.Title" width="100" height="75" /></td>
        <td><h4 style="margin:50 50 50 50">@Html.DisplayFor(model => model.Title)</h4></td>
    </tr>
</table>
<br />
@*
<fieldset>
    <legend style="color:White">Tracks</legend>


    <div class="display-label">Title</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Title)
    </div>

    <div class="display-label">Gener</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Gener)
    </div>

    <div class="display-label">Poster</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Poster)
    </div>
    <div class="display-label">ReleaseDate</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.ReleaseDate)
    </div>
</fieldset>
*@


<input id="file_upload" name="file_upload" type="file" />
<input id="uploadLink" onclick="$('#file_upload').uploadifyUpload();" type="button" value="Upload now" />

<script type="text/javascript">
    $(document).ready(function () {

    $("#uploadLink").hide();
    $("#file_upload").uploadify(
    {
        'swf': '@Url.Content("~/Scripts/uploadify/uploadify.swf")',
        'uploader': '@Url.Action("UploadTrack")',
        'formData': { albumId: '@Model.Id' },
        'fileObjName': 'file',        
        'buttonText': 'Select files',
        'multi': true,
        'width': 250,
        'fileTypeDesc': 'Media Files',
        'fileTypeExts': '*.mp3',
        'fileSizeLimit': '8MB',
        'simUploadLimit': 1,
        'auto': true,
        'removeCompleted': false,
        'onUploadError' : function(file, errorCode, errorMsg, errorString) {
            alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
        },
        'onQueueComplete': function(queueData) {
            alert(queueData.uploadsSuccessful + ' files were successfully uploaded.');
        }
    });
});
 </script>

 @*
        'onSelect': function (file) {
            $("#uploadLink").show();
        }*@